

%% Script that constructs the composite index

% Standard deviation of composite index ( underlying log-normal distribution )
Params.stdx = sqrt(   ( Params.omega + Params.eps * ( 1 + Params.eta ) )^2 * Params.stdlL^2 ...
                    + Params.psi^2                    * Params.stdlA^2 + ...
                  - 2 * ( Params.omega + Params.eps * ( 1 + Params.eta ) ) * Params.psi ...
                      * Params.corrlLlA * Params.stdlL * Params.stdlA  ) ...
              / ( Params.omega + Params.psi + Params.eps * ( 1 + Params.eta + Params.psi ) ) ;
              
              

if options.IdenticalLocations == 1
    Params.stdx = 0.01 ;
    Params.stdlL = 0.01 ;
    Params.stdlA = 0.01 ;
end

Params.xL = exp( Params.stdx * norminv( Grids.DensityCutoff ) ) ;
Params.xU = exp( Params.stdx * norminv( 1 - Grids.DensityCutoff ) ) ;


Params.corrax = (   ( Params.omega + Params.eps * ( 1 + Params.eta ) ) * Params.corrlLlA * Params.stdlL ...
                  - Params.psi * Params.stdlA ) / Params.P1 / Params.stdx ;
       
Params.stdaCondx = sqrt( Params.stdlA^2 * ( 1 - Params.corrax^2 ) ) ;    
Params.WelfareAdj = exp( 1.5 * Params.stdaCondx^2 / ( Params.omega + Params.eps * ( 1 + Params.eta ) )^2 ) ;    

Params.aCondx = Params.corrax * Params.stdlA / Params.stdx ;

